<?php

require_once("../model/user.php");
$user_list = new User();
// goi phuong thuc lay danh sach tat ca user
$data = array();
$data = $user_list->getALlUser(); // danh sach tat ca cac user trong CSDL

$regex = "/^admin$/"; // bat dau ket thuc la chuoi admin
$ds_nguoi_dung = array();
foreach($data as $key=>$value)
{
    if(!preg_match($regex, $value['user_role'])) // neu ma user_role la admin thi khong cho add
    {
        $ds_nguoi_dung[] = $value;
    }
}
// getJson danh sach nguoi dung
$jsonData = json_encode($ds_nguoi_dung);
echo $jsonData;